Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Invalid "invalid encryption kms configuration" error #3854

Merged
merged 4 commits into from
Jun 6, 2023
Merged

fix: Invalid "invalid encryption kms configuration" error #3854

merged 4 commits into from
Jun 6, 2023

Conversation

riya-singhal31
Copy link
Contributor

this commit adds the validation for encryption
value as false, and sets the type as none

Fixes: #3759

@mergify mergify bot added the component/rbd Issues related to RBD label May 24, 2023
@riya-singhal31 riya-singhal31 changed the title rbd: add check for EncryptionTypeNone fix: Invalid "invalid encryption kms configuration" error May 24, 2023
@mergify mergify bot added the bug Something isn't working label May 24, 2023
internal/rbd/encryption.go Outdated Show resolved Hide resolved
Copy link
Collaborator

@Madhu-1 Madhu-1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add an E2E for it.

@riya-singhal31
Copy link
Contributor Author

Please add an E2E for it.

Yes, adding an unit test for it.

{
testName: "Valid Encryption Option With KMS ID",
volOptions: map[string]string{
"encrypted": "true",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you add an other test with encrypted set to an invalid string (not true or false)?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done, thanks!

@Madhu-1
Copy link
Collaborator

Madhu-1 commented May 30, 2023

@riya-singhal31 CI problem, you can run the tests locally by running commands like CONTAINER_CMD=docker make containerized-test TARGET=go-lint you just need to adjust the TARGET to run different tests

@riya-singhal31
Copy link
Contributor Author

@riya-singhal31 CI problem, you can run the tests locally by running commands like CONTAINER_CMD=docker make containerized-test TARGET=go-lint you just need to adjust the TARGET to run different tests

Sure, thanks Madhu.

e2e/rbd.go Outdated
@@ -2872,6 +2872,56 @@ var _ = Describe("RBD", func() {
}
})

By("create storageClass with encrypted as false", func() {
encrypted := "false"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no need for a new variable just set this in map at line 2886

@@ -344,6 +344,13 @@ func ParseEncryptionOpts(
if !ok {
return "", util.EncryptionTypeNone, nil
}
val, er := strconv.ParseBool(encrypted)
if er != nil {
return "", util.EncryptionTypeInvalid, fmt.Errorf("strconv.ParseBool: parsing %s: invalid syntax", encrypted)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of defining our own error just return the error er here?

fallbackType util.EncryptionType
expectedKMS string
expectedEnc util.EncryptionType
expectedErr string
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of a string, you can just check error is expected or not with a bool value here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the review, Madhu.
Updated the PR with mentioned changes.

@Madhu-1 Madhu-1 added the backport-to-release-v3.8 backport to release 3.8 branch label May 31, 2023
Madhu-1
Madhu-1 previously approved these changes May 31, 2023
Copy link
Member

@nixpanic nixpanic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just a small nit to make the code a little cleaner

internal/rbd/encryption.go Outdated Show resolved Hide resolved
@mergify mergify bot dismissed Madhu-1’s stale review June 1, 2023 19:38

Pull request has been modified.

@riya-singhal31
Copy link
Contributor Author

just a small nit to make the code a little cleaner

Thanks for the suggestion Niels, updated.

@nixpanic nixpanic requested a review from a team June 2, 2023 07:36
@riya-singhal31
Copy link
Contributor Author

Hi @Madhu-1 ,
With the recent commit, the approval got removed. So, requesting you to please approve it again if you find it good.

@Madhu-1 Madhu-1 added the ok-to-test Label to trigger E2E tests label Jun 6, 2023
@ceph-csi-bot
Copy link
Collaborator

/test ci/centos/k8s-e2e-external-storage/1.24

@ceph-csi-bot
Copy link
Collaborator

/test ci/centos/k8s-e2e-external-storage/1.25

@ceph-csi-bot
Copy link
Collaborator

/test ci/centos/k8s-e2e-external-storage/1.26

@ceph-csi-bot
Copy link
Collaborator

/test ci/centos/k8s-e2e-external-storage/1.27

@ceph-csi-bot
Copy link
Collaborator

/test ci/centos/mini-e2e-helm/k8s-1.24

@ceph-csi-bot
Copy link
Collaborator

/test ci/centos/mini-e2e/k8s-1.27

@ceph-csi-bot
Copy link
Collaborator

/test ci/centos/upgrade-tests-cephfs

@ceph-csi-bot
Copy link
Collaborator

/test ci/centos/upgrade-tests-rbd

@ceph-csi-bot ceph-csi-bot removed the ok-to-test Label to trigger E2E tests label Jun 6, 2023
@riya-singhal31
Copy link
Contributor Author

/test ci/centos/mini-e2e/k8s-1.26

this commit adds the validation for encryption
value as false, and sets the type as none

Signed-off-by: riya-singhal31 <rsinghal@redhat.com>
Signed-off-by: riya-singhal31 <rsinghal@redhat.com>
Signed-off-by: riya-singhal31 <rsinghal@redhat.com>
Signed-off-by: riya-singhal31 <rsinghal@redhat.com>
@mergify mergify bot added the ok-to-test Label to trigger E2E tests label Jun 6, 2023
@ceph-csi-bot
Copy link
Collaborator

/test ci/centos/k8s-e2e-external-storage/1.24

@ceph-csi-bot
Copy link
Collaborator

/test ci/centos/k8s-e2e-external-storage/1.25

@ceph-csi-bot
Copy link
Collaborator

/test ci/centos/k8s-e2e-external-storage/1.26

@ceph-csi-bot
Copy link
Collaborator

/test ci/centos/k8s-e2e-external-storage/1.27

@ceph-csi-bot
Copy link
Collaborator

/test ci/centos/mini-e2e-helm/k8s-1.24

@ceph-csi-bot
Copy link
Collaborator

/test ci/centos/mini-e2e-helm/k8s-1.25

@ceph-csi-bot
Copy link
Collaborator

/test ci/centos/mini-e2e-helm/k8s-1.26

@ceph-csi-bot
Copy link
Collaborator

/test ci/centos/mini-e2e-helm/k8s-1.27

@ceph-csi-bot
Copy link
Collaborator

/test ci/centos/mini-e2e/k8s-1.24

@ceph-csi-bot
Copy link
Collaborator

/test ci/centos/mini-e2e/k8s-1.25

@ceph-csi-bot
Copy link
Collaborator

/test ci/centos/mini-e2e/k8s-1.26

@ceph-csi-bot
Copy link
Collaborator

/test ci/centos/mini-e2e/k8s-1.27

@ceph-csi-bot
Copy link
Collaborator

/test ci/centos/upgrade-tests-cephfs

@ceph-csi-bot
Copy link
Collaborator

/test ci/centos/upgrade-tests-rbd

@ceph-csi-bot ceph-csi-bot removed the ok-to-test Label to trigger E2E tests label Jun 6, 2023
@mergify mergify bot merged commit b5e68c8 into ceph:devel Jun 6, 2023
@riya-singhal31
Copy link
Contributor Author

/cherry-pick release-4.13

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-to-release-v3.8 backport to release 3.8 branch bug Something isn't working component/rbd Issues related to RBD
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Invalid "invalid encryption kms configuration" error
4 participants